<template>
  <div class="index absolute index-bj{">
    <div class="share">
      <img src="http://diandian.zgkpz.com/images/m_index/share.png" />
    </div>
    <div class="main">
      <div class="users">
        <div class="userInfo" @click="user">
          <img src="http://diandian.zgkpz.com/images/m_index/touxiang.png" />
          <span>
            <p>井然</p>
            <p>10岁</p>
          </span>
        </div>
      </div>
      <div class="menu">
        <div>
          <img
            src="http://diandian.zgkpz.com/images/m_index/rank.png"
            class="menu_img"
            @click="rank"
          />
        </div>
        <div>
          <img
            src="http://diandian.zgkpz.com/images/m_index/huiben.png"
            class="menu_img"
            @click="huiben"
          />
        </div>
        <div>
          <img
            src="http://diandian.zgkpz.com/images/m_index/read.png"
            class="menu_img"
            @click="gendu"
          />
        </div>
        <div>
          <img
            src="http://diandian.zgkpz.com/images/m_index/learn.png"
            class="menu_img"
            @click="xuexi"
          />
        </div>
      </div>
    </div>
    <div class="index-one" @click="mfcb('魔法城堡')">
      
    </div>
    <div class="index-two" @click="mfcb('动物乐园')">
     
    </div>
    <div class="index-three" @click="mfcb('神奇树屋')">
      
    </div>
    <div class="index-four" @click="mfcb('盛林探险')">
     
    </div>
  </div>
</template>
<script>
export default {
  name: "Index",
  data: function() {
    return {
      screenWidth: document.body.clientWidth
    };
  },
  created() {
    window.addEventListener("resize", this.handleResize);
  },
  mounted: function() {},
  methods: {
    //魔法城堡
    mfcb(e){
      alert(e)
    },
    handleResize() {
      if (document.body.clientWidth > 768) {
        this.$router.replace({ path: "/web/index" });
      }
    },
    rank() {
      this.$router.replace({ path: "/rank" });
    },
    huiben() {
      this.$router.replace({ path: "/main" });
    },
    gendu() {
      this.$router.replace({ path: "/rank" });
    },
    xuexi() {
      this.$router.replace({ path: "/log" });
    },
    user() {
      this.$router.replace({ path: "/user" });
    }
  }
};
</script>
<style scoped>
.index-bj{
  position: relative;
}

.index-one{
   position: absolute;
    top: 19%;
    left: 8%;
    width: 2rem;
    height: 2rem;
}

.index-two{
       position: absolute;
    top: 9%;
    left: 66%;
    width: 2.3rem;
    height: 2rem;
}
.index-three{
  position: absolute;
    top: 37%;
    left: 54%;
    width: 2.3rem;
    height: 2.5rem;
}

.index-four{
     position: absolute;
    top: 60%;
    left: 17%;
    width: 2.5rem;
    height: 2.5rem;
}


.main {
  position: fixed;
  bottom: 0;
  display: inline-flex;
  width: 100%;
  background: url("http://diandian.zgkpz.com/images/m_index/white.png" )
  no-repeat;
  background-size: 100% 100%;
  height: 1.5rem;
}
.main .users {
  width: 40%;
  color: #20644a;
  text-align: center;
  margin: auto;
  padding-top: 0.2rem;
}
.main .users img {
  width: 1rem;
}
.userInfo {
  display: inline-flex;
  background: url("http://diandian.zgkpz.com/images/m_index/juxing.png")
    no-repeat;
  background-size: cover;
  width: 2.5rem;
  height: 1rem;
}
.userInfo p {
  font-size: 0.2rem;
}
.userInfo span {
  padding: 0.2rem;
}
.main .menu {
  width: 60%;
  display: flex;
  justify-content: space-around;
  margin: auto;
}
.main .menu_img {
  height: 0.85rem;
}
.share {
  position: relative;
  top: 35%;
  float: right;
  padding-right:0.3rem
}
.share img {
  width: 0.8rem;
}



@media (max-width:500px) {
  .index-one{
  position: absolute;
    top: 20%;
    left: 5%;
    width: 2.6rem;
    height: 2.6rem;
}

.index-two{
  position: absolute;
    top: 9%;
    left: 66%;
    width: 2.5rem;
    height: 2.5rem;
}
.index-three{
position: absolute;
    top: 37%;
    left: 51%;
    width: 2.5rem;
    height: 3.2rem;
}

.index-four{
       position: absolute;
    top: 64%;
    left: 17%;
    width: 3rem;
    height: 3rem;
}
}

</style>
